package com.infore.qualityControl.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.infore.qualityControl.entity.EquipmentParameter;

@Repository
public interface IEquipmentParameterRepository
		extends JpaRepository<EquipmentParameter, String>, JpaSpecificationExecutor<EquipmentParameter> {
	/** 根据站点ID查询 **/
	List<EquipmentParameter> findByStationCodeIn(List<String> stationCodes);
	/** 根据站点ID、监测项编码查询 **/
	List<EquipmentParameter> findByStationCodeInAndIndexCodeIn(List<String> stationCodes, List<String> indexCodes);

	/** 根据设备参数ID更新参数值 **/
	@Modifying
	@Transactional
	@Query(value = "UPDATE EQUIPMENT_PARAMETER SET PARAMETER_VALUE = :parameterValue WHERE PARAMETER_ID = :parameterId ", nativeQuery = true)
	int updateParameterValue(@Param("parameterValue") String parameterValue, @Param("parameterId") String parameterId);
}
